import type { App } from 'vue'

/**
 * @method 注册全局自定义指令
 * @param app
 */
export default function globalRegisterDirective(app: App) {
  Object.values(import.meta.glob<boolean, string, { default: FN<App> }>('./*.ts')).forEach(async (directiveFn) => {
    try {
      const module = await directiveFn()
      module.default(app)
    } catch (error) {
      throw new Error('自定义指令初始化异常' + error)
    }
  })
}
